package com.baizhi.service.impl;

import com.baizhi.dao.AdminDao;
import com.baizhi.entity.CmfzAdmin;
import com.baizhi.entity.CmfzBanner;
import com.baizhi.service.AdminService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class AdminServiceImpl implements AdminService {
@Autowired
  private AdminDao ad;
    @Override
    @Transactional(readOnly = true)
    public CmfzAdmin selectOne(int id) {
        return  ad.selectOne(id);
    }

  @Override
  public Page<CmfzAdmin> adminListByPage(int pageNo, int pageSize) {
      Page<CmfzAdmin> page = new Page<>(pageNo, pageSize);
      Page<CmfzAdmin> cmfzAdminPage = ad.selectPage(page, null);

      return cmfzAdminPage;
  }

  @Override
  public void insert(CmfzAdmin admin) {
        ad.insert(admin);

  }

  @Override
  public void delete(int id) {
    ad.deleteById(id);
  }

  @Override
  public void update(CmfzAdmin admin) {
    ad.updateById(admin);
  }
}
